<% content_for(:page_title, "#{@merchant_merchant_group.name} 的当前商户") %>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <% if can? :update, Merchant::MerchantGroup %>
                    <a type="button" class="btn btn-success" href="<%= new_merchant_merchant_group_merchant_store_path %>"><i class="fa fa-plus"></i>
                        新增商户</a>
                    <a type="button" class="btn btn-danger store_selector_submit" id="delete_stores">
                        删除选中商户</a>
                <% end %>
                <a type="button" class="btn btn-default store_selector_submit" href="<%= merchant_merchant_groups_path%>">返回</a>
            </div>
            <!-- /.panel-heading -->
            <div class="panel-body">
                <%= search_form_for(@q, url: merchant_merchant_group_merchant_stores_path(@merchant_merchant_group), class: 'form-inline', role: 'form') do |f| %>
                    <div class="form-group">
                        <%= f.search_field :name_cont, class: 'form-control', placeholder: '商户名' %>
                    </div>
                    <button type="submit" class="btn btn-primary"><i class="fa fa-fighter-jet"></i> 查询</button>
                <% end %>
                <br>

                <div class="row">
                    <%= render partial: 'shared/index_table_entries_info', locals: {collection: @merchant_stores, model: 'merchant_store'} %>
                </div>
                <br>

                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th width="5%"></th>
                            <th>商户名</th>
                            <th>商户号</th>
                        </tr>
                        </thead>
                        <tbody>
                        <%= form_tag("/merchant/merchant_groups/#{@merchant_merchant_group.id}/merchant_stores", method: :delete, id: 'store_selector') do %>
                            <%= render partial: 'merchant_store', collection: @merchant_stores, as: :merchant_store %>
                        <% end %>
                        </tbody>
                    </table>
                </div>
                <!-- /.table-responsive -->
                <div class="row">
                    <%= render partial: 'shared/index_table_entries_info', locals: {collection: @merchant_stores, model: 'merchant_store'} %>
                </div>
            </div>
            <!-- /.panel-body -->
        </div>
        <!-- /.panel -->
    </div>
    <!-- /.col-lg-12 -->
</div>

